package org.ITschool.support.util;

import java.io.IOException;
import java.io.InputStream;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SessionFactory {
   public SqlSession openSession(){
	   InputStream is;
	   SqlSession session=null;
	 		try {
	 			is = Resources.getResourceAsStream("ITschool_Mybatis.xml");
	 			org.apache.ibatis.session.SqlSessionFactory sessionFactory=new SqlSessionFactoryBuilder().build(is);
	 		        session=sessionFactory.openSession();
	 		       return session;
	 		} catch (IOException e) {
	 			// TODO Auto-generated catch block
	 			e.printStackTrace();
	 		}
	 		return session;
   }
}
